package com.lhr.common.util;

import java.math.BigDecimal;

public class DoubleUtil {

	/**
	 * 加
	 */
	public static double add(double value1,
			double... value2) {
		BigDecimal decimal = new BigDecimal(String.valueOf(value1));
		for (double val : value2) {
			decimal = decimal.add(new BigDecimal(String.valueOf(val)));
		}
		return decimal.doubleValue();
	}

	/**
	 * 减
	 */
	public static double subtract(double value1,
			double... value2) {
		BigDecimal decimal = new BigDecimal(String.valueOf(value1));
		for (double val : value2) {
			decimal = decimal.subtract(new BigDecimal(String.valueOf(val)));
		}
		return decimal.doubleValue();
	}

	/**
	 * 乘
	 */
	public static double multiply(double value1,
			double... value2) {
		BigDecimal decimal = new BigDecimal(String.valueOf(value1));
		for (double val : value2) {
			decimal = decimal.multiply(new BigDecimal(String.valueOf(val)));
		}
		return decimal.doubleValue();
	}
}
